package scuff.msg.json.jackson

import scuff.msg._
import scuff.msg.json.ReflectiveDispatchingJsonReader
import scuff.msg.util.Classifier

import com.fasterxml.jackson._, databind.ObjectMapper

abstract class ReflectiveJacksonReader[CB, PL <: scuff.DoubleDispatch[CB]](mapper: ObjectMapper = new ObjectMapper)
    extends ReflectiveDispatchingJsonReader[CB, PL] {

  protected def deserialize(pl: String, msgType: Class[_ <: PL]): PL = {
    val foo = mapper.readValue(pl, msgType)
    foo.asInstanceOf[PL]
  }

}